package ph.gov.marikina.mcsmtms.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import ph.gov.marikina.mcsmtms.dao.ActivityFeedsDAO;
import ph.gov.marikina.mcsmtms.domain.ActivityFeeds;

@Transactional
@Repository 
public class ActivityFeedsDAOImpl implements ActivityFeedsDAO {
	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	/* (non-Javadoc)
	 * @see ph.gov.marikina.mcsmtms.dao.impl.ActivityFeedsDAO#getAllNotitications()
	 */
	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public List<ActivityFeeds> getAllActivityFeeds() {
		Query query = this.sessionFactory.getCurrentSession()
                .createQuery("from ActivityFeeds");
		
		return (List) query.list();
	}

}
